package ar.com.photo_admin.domain
class Message extends DomainObject {

	String subject
	
	String message

	static belongsTo = [userMessage : UserMessage, from : User]
	
    static constraints = {
        subject(blank:false, nullable:false, size: 1..30)
		message(blank:false, nullable:false, size: 1..350)
    }		static namedQueries = {		sent { user ->			eq('from', user)			eq('deleted', false)		}				received { user ->			createAlias('userMessage', 'um')			eq('um.to', user)			eq('um.deleted', false)			eq('um.trash', false)		}				trash { user ->			createAlias('userMessage', 'um')			eq('um.to', user)			eq('um.deleted', false)			eq('um.trash', true)		}	}
}
